"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const defines_1 = require("../lib/defines");
function applyJoin(app) {
    const { socket, rooms } = app.locals;
    const { userId, username } = socket.handshake.query;
    socket.on(defines_1.RequestMethod.applyJoin, function createApplyJoin(room, cb) {
        const member = { userId, username };
        const __room = rooms[room.classId];
        const creator = __room.creator;
        socket
            .timeout(1000 * 60)
            .to(creator.socketId)
            .emit(defines_1.RequestMethod.applyJoin, { member }, () => {
            cb && cb({ status: 'ok' });
        });
    });
}
exports.default = applyJoin;
